<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>connectSQL &#8212; SQL Connection Handler &mdash; Interop Router 3.3.0 documentation</title>
    <link rel="stylesheet" href="../../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
          URL_ROOT:    '../../',
          VERSION:     '0',
          COLLAPSE_MODINDEX: false,
          FILE_SUFFIX: '.html'
      };
    </script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
    <link rel="top" title="Interop Router 3.3.0 documentation" href="../../index.html" />
    <link rel="up" title="Python Modules" href="mod_index.html" />
    <link rel="next" title="data &#8212; Data Abstraction Classes" href="data.html" />
    <link rel="prev" title="clusters &#8212; Cluster Interface" href="clusters.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../modindex.html" title="Global Module Index"
             accesskey="M">modules</a> |</li>
        <li class="right" >
          <a href="data.html" title="data &#8212; Data Abstraction Classes"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="clusters.html" title="clusters &#8212; Cluster Interface"
             accesskey="P">previous</a> |</li>
        <li><a href="../../index.html">Interop Router 3.3.0 documentation</a> &raquo;</li>
          <li><a href="../index.html" accesskey="U">Deemon Documentation</a> &raquo;</li>
          <li><a href="mod_index.html" accesskey="U">Python Modules</a> &raquo;</li> 
      </ul>
    </div>  
    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  
  <div class="section" id="module-connectSQL">
<h1><tt class="xref docutils literal"><span class="pre">connectSQL</span></tt> &#8212; SQL Connection Handler<a class="headerlink" href="#module-connectSQL" title="Permalink to this headline">¶</a></h1>
<p>This module connects the Daemon and the SQL Database.</p>
<p>Until version 3.3, the SQL Database is a MySQL server and uses the MySQLdb module.
It&#8217;s possible extend it to others SQL Databases, like PostgreeSQL or SQL Server.</p>
<dl class="class">
<dt id="connectSQL.ConnectSQL">
<!--[connectSQL.ConnectSQL]-->class <tt class="descname">ConnectSQL</tt><big>(</big><em>params</em><big>)</big><a class="headerlink" href="#connectSQL.ConnectSQL" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">object</span></tt></p>
<p>The SQL Database interface.</p>
<p>This Class has methods to get data of jobs, project, source code, also 
send the results back to database.</p>
<p>In the future, will able to connect using several sql engines.</p>
<p>The Class&#8217; constructor.</p>
<blockquote>
<p>Receives the information about the database and the deemon account for 
this cluster usign a dict params.</p>
<p>Util version 3.3, only access MySQL databases, but extends to other 
sql engines is easy.</p>
<p>Return a cursor to database, or raise an ErroSQL if not possible
connect with the database.</p>
</blockquote>
<dl class="method">
<dt id="connectSQL.ConnectSQL.closeConn">
<!--[connectSQL.ConnectSQL.closeConn]--><tt class="descname">closeConn</tt><big>(</big><big>)</big><a class="headerlink" href="#connectSQL.ConnectSQL.closeConn" title="Permalink to this definition">¶</a></dt>
<dd>Close the connection with de SQL Database.</dd></dl>

<dl class="method">
<dt id="connectSQL.ConnectSQL.getJob">
<!--[connectSQL.ConnectSQL.getJob]--><tt class="descname">getJob</tt><big>(</big><em>clusterID</em><big>)</big><a class="headerlink" href="#connectSQL.ConnectSQL.getJob" title="Permalink to this definition">¶</a></dt>
<dd><p>Verify if there are new jobs for this clusterID
in the Interop Router queue and 
get the job information from the Database.</p>
<p>Returns a tuple that contains the Job&#8217;s fields: JobId, ProjectId
JobName and the datafile in the job.</p>
<p>Also, add in the DB information about the time when the 
operation occours.</p>
</dd></dl>

<dl class="method">
<dt id="connectSQL.ConnectSQL.getProject">
<!--[connectSQL.ConnectSQL.getProject]--><tt class="descname">getProject</tt><big>(</big><em>projectId</em><big>)</big><a class="headerlink" href="#connectSQL.ConnectSQL.getProject" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the information about the project with id equal to projectId.</p>
<p>Returns a tuple that contains the parameters to execute the application
and the number of processors per cluster node used for this 
application when running at a cluster.</p>
</dd></dl>

<dl class="method">
<dt id="connectSQL.ConnectSQL.getSourceCode">
<!--[connectSQL.ConnectSQL.getSourceCode]--><tt class="descname">getSourceCode</tt><big>(</big><em>projectId</em><big>)</big><a class="headerlink" href="#connectSQL.ConnectSQL.getSourceCode" title="Permalink to this definition">¶</a></dt>
<dd>Get Project&#8217;s Source Code from the Database.</dd></dl>

<dl class="method">
<dt id="connectSQL.ConnectSQL.sendResults">
<!--[connectSQL.ConnectSQL.sendResults]--><tt class="descname">sendResults</tt><big>(</big><em>cluster</em>, <em>job</em>, <em>status=2</em><big>)</big><a class="headerlink" href="#connectSQL.ConnectSQL.sendResults" title="Permalink to this definition">¶</a></dt>
<dd><p>Send the Job&#8217;s standard and error output and 
send them to the database.</p>
<p>Also, add in the DB information about the time 
when the operation occours.</p>
</dd></dl>

<dl class="method">
<dt id="connectSQL.ConnectSQL.sendWorkLoad">
<!--[connectSQL.ConnectSQL.sendWorkLoad]--><tt class="descname">sendWorkLoad</tt><big>(</big><em>id</em>, <em>idle</em><big>)</big><a class="headerlink" href="#connectSQL.ConnectSQL.sendWorkLoad" title="Permalink to this definition">¶</a></dt>
<dd>Send the idle cores number of the cluster to database.</dd></dl>

</dd></dl>

</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h4>Previous topic</h4>
            <p class="topless"><a href="clusters.html" title="previous chapter"><tt class="docutils literal"><span class="pre">clusters</span></tt> &#8212; Cluster Interface</a></p>
            <h4>Next topic</h4>
            <p class="topless"><a href="data.html" title="next chapter"><tt class="docutils literal"><span class="pre">data</span></tt> &#8212; Data Abstraction Classes</a></p>
            <h3>This Page</h3>
            <ul class="this-page-menu">
              <li><a href="../../_sources/deemon/modules/connectSQL.txt">Show Source</a></li>
            </ul>
          <h3>Quick search</h3>
            <form class="search" action="../../search.html" method="get">
              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
              <input type="hidden" name="check_keywords" value="yes" />
              <input type="hidden" name="area" value="default" />
            </form>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../modindex.html" title="Global Module Index"
             accesskey="M">modules</a> |</li>
        <li class="right" >
          <a href="data.html" title="data &#8212; Data Abstraction Classes"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="clusters.html" title="clusters &#8212; Cluster Interface"
             accesskey="P">previous</a> |</li>
        <li><a href="../../index.html">Interop Router 3.3.0 documentation</a> &raquo;</li>
          <li><a href="../index.html" accesskey="U">Deemon Documentation</a> &raquo;</li>
          <li><a href="mod_index.html" accesskey="U">Python Modules</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
      &copy; Copyright .
      Last updated on Dec 17, 2008.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
    </div>
  </body>
</html>